using UnityEngine;
using System.Collections;

/// <summary>
/// This script goes on the object that is grabbing the sword
/// </summary>
public class Player : MonoBehaviour {
	public int life;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (isDead())
			Debug.Log("-----PLAYER IS DEAD-----");
	}
	
	/// <summary>
	/// Hurt the player with specified damage.
	/// </summary>
	/// <param name='damage'>
	/// The damage that player will take.
	/// </param>
	public void hurt(int damage)
	{
		if (life > 0)
		{
			life -= damage;
		}
	}
	
	/// <summary>
	/// Check if the palyer is dead
	/// </summary>
	/// <returns>
	/// The dead.
	/// </returns>
	public bool isDead()
	{
		return life <= 0;
	}
}
